package io.dbw;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.Environment;
import org.springframework.scheduling.annotation.EnableScheduling;

import lombok.extern.slf4j.Slf4j;


@SpringBootApplication
@EnableScheduling
@Slf4j
public class ServerApplication extends SpringBootServletInitializer {

	public static void main(String[] args) {
		ConfigurableApplicationContext run = SpringApplication.run(ServerApplication.class, args);
		log.info("(♥◠‿◠)ﾉﾞ  系统启动成功   ლ(´ڡ`ლ)ﾞ  ");
		Environment environment = run.getBean(Environment.class);
		log.info("\n\t---------------------------------------------------"
				+ "\n\tApplication " + environment.getProperty("spring.application.name")
				+ " is running!\n\tlocal：http://localhost:" + environment.getProperty("server.port") + environment.getProperty("server.servlet.context-path")
				+"\n\t---------------------------------------------------");
	}

	@Override
	protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
		return application.sources(ServerApplication.class);
	}

}